#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
import socket

sk = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

sk.bind(('127.0.0.1', 6666))

sk.listen(5)

conn, address = sk.accept()

while True:
    data = conn.recv(1024).decode()
    if data == "exit": break
    print("来自 {0} 发送的数据: {1}".format(address, data))
    conn.sendall(data.encode())

conn.close()
